package NovelBar.controller;

import NovelBar.entity.Notice;
import NovelBar.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class NoticeController {
    @Autowired
    private NoticeService noticeService;

    @RequestMapping("/public/loadAllNotice")
    public List<Notice> loadAllNotice() {
       return noticeService.loadAllNotice();
    }

    @RequestMapping("/admin/insertNotice")
    public void insertNotice(Notice notice) {
        noticeService.insertNotice(notice);
    }

    @RequestMapping("/admin/deleteNoticeById")
    public void deleteNoticeById(Integer id) {
        noticeService.deleteNoticeById(id);
    }

    @RequestMapping("/admin/updateNotice")
    public void updateNotice(Notice notice) {
        noticeService.updateNotice(notice);
    }
}
